#ifndef QTCPTHREAD_H
#define QTCPTHREAD_H

#include <QObject>

//add by dimon, 2024-03-18 15:125
#include <QThread>
#include <QTcpSocket>
#include "qmydb.h"

/****************************************************************
 * TCP线程: QTcpThread
 * 功能：处理TCP连接（来自客户端的注册或登陆请求）
 ****************************************************************/

//基类为 QThread
class QTcpThread : public QThread
{
    Q_OBJECT
public:
    explicit QTcpThread(int socketDescriptor, QObject *parent = nullptr);
    ~QTcpThread();
    void run();

private:
    int socketDescriptor;
    QTcpSocket *tcpSocket;
    QMyDB *db;

signals:
    void error(QTcpSocket::SocketError socketError);

private slots:
    void onReadyRead();

};

#endif // QTCPTHREAD_H
